package com.xiyu.service.vo.mailbox.mail;

import com.xiyu.service.vo.mailbox.mail.baseVO.MailboxMailBase;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;
import com.xiyu.service.enums.common.CommonStatusEnum;
import com.xiyu.service.framework.validation.InEnum;

@Schema(description = "保存或发送邮件")
@Data
public class MailSaveMailInput extends MailboxMailBase {

    @Schema(description = "邮件收件人")
    @Valid
    private List<receiver> receivers;

    @Schema(description = "邮件抄送人")
    @Valid
    private List<carbonReceiver> carbonReceivers;

    @Schema(description = "邮件密送人")
    @Valid
    private List<blindReceiver> blindReceivers;

    @Schema(description = "邮件主键ID")
    private Long id;

    @Schema(description = "保存类型")
    private Integer type;

    @Schema(description = "邮件正文")
    @Valid
    private content content;

    @Schema(description = "邮件资源")
    @Valid
    private List<resource> resources;

    @Schema(description = "邮件资源")
    @Data
    @Valid
    public static class resource {

        @Schema(description = "url路径")
        @NotBlank(message = "附件url路径不能为空")
        private String urlName;

        @Schema(description = "资源类型")
        private Integer resourceType;

        @Schema(description = "文件大小")
        private Integer size;

        @Schema(description = "文件名")
        @NotBlank(message = "附件文件名不能为空")
        private String fileName;
    }

    @Schema(description = "邮件正文")
    @Data
    @Valid
    public static class content {

        @Schema(description = "邮件正文")
        private String content;
    }

    @Schema(description = "邮件密送人")
    @Data
    @Valid
    public static class blindReceiver {

        @Schema(description = "收件人姓名")
        private String name;

        @Schema(description = "收件人地址")
        @NotBlank(message = "密送人邮件地址不能为空")
        private String address;
    }

    @Schema(description = "邮件抄送人")
    @Data
    @Valid
    public static class carbonReceiver {

        @Schema(description = "收件人姓名")
        private String name;

        @Schema(description = "收件人地址")
        @NotBlank(message = "抄送人邮件地址不能为空")
        private String address;
    }

    @Schema(description = "邮件收件人")
    @Data
    @Valid
    public static class receiver {

        @Schema(description = "收件人地址")
        @NotBlank(message = "收件人邮件地址不能为空")
        private String address;

        @Schema(description = "收件人姓名")
        private String name;
    }

}